if windows then
    if target == "vs2005" then
        msvc_crt = 80
    elseif target == "vs2003" then
        msvc_crt = 71
    end
    DEPDIR = "../deps/win32"
else
    local f = io.popen("arch")
    local _,_,arch = string.find(f:read("*a"), "([^%s]+)")
    f:close()
    if arch == "x86_64" then
        linuxbits = 64
    else
        linuxbits = 32
    end
    print(linuxbits.."bit detected")
    DEPDIR = "../deps/linux_"..linuxbits
    print("Dependency dir set to: "..DEPDIR)
end

-- project config
project.name = "unlimitedworlds"
project.bindir = "bin"
project.libdir = "lib"

-- package config
package = newpackage()
package.name = "unlimitedworlds"
package.kind = "exe"
package.language = "c++"
-- package.objdir = "obj/"
package.config["Debug"].objdir = "obj/Debug"
package.config["Release"].objdir = "obj/Release"

-- package files
package.files = {
    matchrecursive( "src/*.cpp", "include/*.h" ),
}

-- defines
if windows then
    package.defines = { "WIN32", "_WIN32", "_WINDOWS" }
else
    package.defines = { "LINUX" }
end

package.config.Debug.defines = { "DEBUG", "_DEBUG", "_STLP_DEBUG" }
package.config.Release.defines = { "NDEBUG", "_NDEBUG" }

-- include paths
if windows then
    package.includepaths = {
        "include",
	"../XGE/include",
        -- DEPDIR.."/nvsg/include/nvsg",
    }
else
    package.includepaths = {
        "include",
	"../XGE/include",
        "/usr/local/include/OGRE/",
    }
end

-- library paths
if windows then
    -- windows
    package.libpaths = {
        "../XGE/lib",
    }
    package.config.Debug.libpaths = {
        -- DEPDIR.."/nvsg/lib/crt"..msvc_crt.."/Debug",
    }
    package.config.Release.libpaths = {
        -- DEPDIR.."/nvsg/lib/crt"..msvc_crt.."/Release",
    }
else
    -- linux
    local arch = linuxbits == 64 and "amd64" or "x86"
    package.libpaths = {
        "../XGE/lib",
    }
    package.config.Debug.libpaths = {
        -- DEPDIR.."/nvsg/bin/"..arch.."/linux/debug",
    }
    package.config.Release.libpaths = {
        -- DEPDIR.."/nvsg/bin/"..arch.."/linux/release",
    }
end

-- linking libs
if windows then
    package.links = {
        "OGRE"
    }
else
    package.links = {
        "OGRE",
    }
end

-- platform specific compiler options
if linux then
    -- package.buildoptions = { "-ffriend-injection", "-include ../force_mtalloc.h" } -- needed for nvsg with gcc 4.1
end

